//
//  QuestionViewController.m
//  盘盈贷
//
//  Created by iOS on 15/3/26.
//  Copyright (c) 2015年 Yunpeng Technologies. All rights reserved.
//

#import "QuestionViewController.h"
#import "NIDropDown.h"
#import "QuartzCore/QuartzCore.h"

@interface QuestionViewController ()<NIDropDownDelegate>
{
    UIButton *select;
    NIDropDown *dropDown;
    UITableView *tv;//下拉列表
    NSMutableArray *tableArray;//下拉列表数据
    UITextField *textField;//文本输入框
    BOOL showList;//是否弹出下拉列表
    CGFloat tabheight;//table下拉列表的高度
    CGFloat frameHeight;//frame的高度
}
@end

@implementation QuestionViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"修改密保问题";
    CGFloat width = self.view.frame.size.width;
    CGFloat height = self.view.frame.size.height;
    UILabel *top = [[UILabel alloc] initWithFrame:CGRectMake(0, height / 9, width, height / 7.1)];
    top.text = @"温馨提示:为了避免以往,帮您填写真实信息,这将帮助您以后通过回答问题快速找回盘盈贷密码,还可以通过手机找回密码和邮箱绑定找回密码";
    top.numberOfLines = 0;
    top.font = [UIFont systemFontOfSize:15];
    top.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:top];
    [top release];
    
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(0, height / 3.8, 100, 30)];
    //label1.center = CGPointMake(0, height / 6);
   // label1.backgroundColor = [UIColor redColor];
    label1.text = @"问题一";
    [self.view addSubview:label1];
    [label1 release];
    select = [[UIButton alloc] initWithFrame:CGRectMake(0, height / 2.9, 260, 30)];
    select.layer.borderWidth = 1;
    select.layer.borderColor = [[UIColor blackColor] CGColor];
    select.layer.cornerRadius = 5;
     [select addTarget:self action:@selector(selectClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:select];
    
}
- (void)viewDidUnload {
     [select release];
     select = nil;
     [self select:nil];
     [super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (IBAction)selectClicked:(id)sender{
    NSArray * arr = [[NSArray alloc] init];
    arr = [NSArray arrayWithObjects:@"您最喜欢的数字是?", @"您上的第一所学校的名字?", @"您最喜欢的运动是?", @"您配偶的名字是?", @"您最想去的地方是?", @"您初中班主任的名字是?", @"您最爱的零食是?", @"您自己的生日是?", @"您的出生地是?",nil];
    if(dropDown == nil) {
        CGFloat f = 200;
        dropDown = [[NIDropDown alloc]showDropDown:sender :&f :arr];
        dropDown.delegate = self;
    }
    else {
        [dropDown hideDropDown:sender];
        [self rel];
    }
}

- (void) niDropDownDelegateMethod: (NIDropDown *) sender {
    [self rel];
}

-(void)rel{
    [dropDown release];
    dropDown = nil;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
